import { ILoadMapTypeAll } from '@/common';
import { getTenantID } from '@/utils';

/**
 * 处理 oldState, state 的参数数据
 * @param orderState  业务详情
 * @param orderType 工单类别
 * @returns
 */
const HandleFlowStateCommon = (orderState: string, orderType: string) => {
  let oldState: string = '';
  let nowState: string = '';
  if (orderState ? orderState?.endsWith('1000') : '') {
    // if (orderType == `${getTenantID()}${ILoadMapTypeAll.ALLORDER_TYPE}1009`) {
    //   // 资产退库
    //   if (orderState?.endsWith(`${ILoadMapTypeAll.ASSETRRETURN_STATE}1000`)) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETRRETURN_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETRRETURN_STATE}1000`;
    //   } else if (
    //     orderState?.endsWith(`${ILoadMapTypeAll.ASSETRRETURN_STATE}1006`)
    //   ) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETRRETURN_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETRRETURN_STATE}1006`;
    //   }
    // } else if (
    //   orderType == `${getTenantID()}${ILoadMapTypeAll.ALLORDER_TYPE}1011`
    // ) {
    //   // 资产处置
    //   if (orderState?.endsWith(`${ILoadMapTypeAll.ASSETHAND_STATE}1000`)) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETHAND_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETHAND_STATE}1000`;
    //   } else if (
    //     orderState?.endsWith(`${ILoadMapTypeAll.ASSETHAND_STATE}1006`)
    //   ) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETHAND_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETHAND_STATE}1007`;
    //   }
    // } else if (
    //   orderType == `${getTenantID()}${ILoadMapTypeAll.ALLORDER_TYPE}1008`
    // ) {
    //   // 资产领用
    //   if (orderState?.endsWith(`${ILoadMapTypeAll.ASSETAPPLY_STATE}1000`)) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETAPPLY_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETAPPLY_STATE}1000`;
    //   } else if (
    //     orderState?.endsWith(`${ILoadMapTypeAll.ASSETAPPLY_STATE}1006`)
    //   ) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETAPPLY_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETAPPLY_STATE}1006`;
    //   }
    // } else if (
    //   orderType == `${getTenantID()}${ILoadMapTypeAll.ALLORDER_TYPE}1010`
    // ) {
    //   // 资产购置
    //   if (orderState?.endsWith(`${ILoadMapTypeAll.ASSETBUY_STATE}1000`)) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETBUY_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETBUY_STATE}1000`;
    //   } else if (
    //     orderState?.endsWith(`${ILoadMapTypeAll.ASSETBUY_STATE}1004`)
    //   ) {
    //     nowState = getTenantID() + `${ILoadMapTypeAll.ASSETBUY_STATE}1001`;
    //     oldState = getTenantID() + `${ILoadMapTypeAll.ASSETBUY_STATE}1004`;
    //   }
    // }
  } else {
    nowState = orderState;
    oldState = orderState;
  }

  return {
    oldState,
    state: nowState,
  };
};

export { HandleFlowStateCommon };
